import { PoolManager } from 'db://assets/Scripts/Framework/Managers/PoolManager';
import { InGameManager } from '../Managers/InGameManager';
import { Item } from './Item';

export class Armor extends Item {

    def: number;
    durability: number;
    maxDurability: number;
    type: number;
    level: number;
    maxNum: number = 1;

    static Init(_num: number): Armor {
        let data = InGameManager.itemsJson.Armor[_num];
        let armor = PoolManager.GetItem(Armor);
        armor.num = 1;
        armor.itemName = data.name;
        armor.def = data.def;
        armor.durability = data.durability;
        armor.maxDurability = data.durability;
        armor.type = data.type;
        armor.level = data.level;
        armor.sfUrl = data.spriteFrame;
        return armor;
    }

}